package com.zywl.service.impl;

import com.zywl.core.beans.Unit;
import com.zywl.core.dao.mapper.sys.UnitMapper;
import com.zywl.service.UnitService;
import com.zywl.service.impl.base.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UnitServiceImpl extends BaseServiceImpl<UnitMapper, Unit> implements UnitService {
    @Override
    public Unit getUnitByUnitNo(String unitNo) throws Exception {
        Map<String, Object> condition = new HashMap<String, Object>();
        condition.put("UNIT_NO", unitNo);
        List<Unit> units = mapper.getListByParams(condition);
        if (units != null && !units.isEmpty()) {
            return units.get(0);
        }
        return null;
    }

    @Override
    public int getListCountByParams(Map<String, Object> condition) throws Exception {
        return mapper.getListCountByParams(condition);
    }
}
